package net.lahuobao.mall.entity.admin;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * @Title: Entity
 * @Description: 商城油卡卡号管理
 * @author zhangdaihao
 * @date 2016-12-02 14:50:58
 * @version V1.0
 *
 */
@Entity
@Table(name = "mall_etc_card_rule", schema = "lahuobao")
@DynamicUpdate(true)
@DynamicInsert(true)
@SuppressWarnings("serial")
public class MallEtcCardRuleEntity implements java.io.Serializable {
    /**id*/
    private java.lang.Integer id;
    /**店铺ID*/
    private java.lang.Integer shopid;
    /**商品ID*/
    private java.lang.Integer productid;
    /**etc供应商ID*/
    private java.lang.Integer etcsupplierid;
    /**卡号*/
    private java.lang.String cardno;
    /**状态，0未使用,1已分配，待审核，2,已使用*/
    private java.lang.Integer state;
    /**时间*/
    private java.util.Date createtime;
    /**操作人*/
    private java.lang.Integer createuserid;

    private MallProductEntity product;

    private MallShopEntity shop;

    private MallEtcSupplierEntity etcSupplier;

    //ETC卡前缀
    private String cardNoPrefix;
    //开始卡号
    private String startCardNo;
    //结束卡号
    private String endCardNo;

    MallEtcUserEntity etcUser = new MallEtcUserEntity();
    /**
     *方法: 取得java.lang.Integer
     *@return: java.lang.Integer  id
     */

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name ="ID",nullable=false,precision=10,scale=0)
    public java.lang.Integer getId(){
        return this.id;
    }

    /**
     *方法: 设置java.lang.Integer
     *@param: java.lang.Integer  id
     */
    public void setId(java.lang.Integer id){
        this.id = id;
    }
    /**
     *方法: 取得java.lang.Integer
     *@return: java.lang.Integer  店铺ID
     */
    @Column(name ="SHOPID",nullable=false,precision=10,scale=0)
    public java.lang.Integer getShopid(){
        return this.shopid;
    }

    /**
     *方法: 设置java.lang.Integer
     *@param: java.lang.Integer  店铺ID
     */
    public void setShopid(java.lang.Integer shopid){
        this.shopid = shopid;
    }
    /**
     *方法: 取得java.lang.Integer
     *@return: java.lang.Integer  商品ID
     */
    @Column(name ="PRODUCTID",nullable=false,precision=10,scale=0)
    public java.lang.Integer getProductid(){
        return this.productid;
    }

    /**
     *方法: 设置java.lang.Integer
     *@param: java.lang.Integer  商品ID
     */
    public void setProductid(java.lang.Integer productid){
        this.productid = productid;
    }
    /**
     *方法: 取得java.lang.Integer
     *@return: java.lang.Integer  etc供应商ID
     */
    @Column(name ="ETCSUPPLIERID",nullable=false,precision=10,scale=0)
    public java.lang.Integer getEtcsupplierid(){
        return this.etcsupplierid;
    }

    /**
     *方法: 设置java.lang.Integer
     *@param: java.lang.Integer  etc供应商ID
     */
    public void setEtcsupplierid(java.lang.Integer etcsupplierid){
        this.etcsupplierid = etcsupplierid;
    }
    /**
     *方法: 取得java.lang.String
     *@return: java.lang.String  卡号
     */
    @Column(name ="CARDNO",nullable=false,length=50)
    public java.lang.String getCardno(){
        return this.cardno;
    }

    /**
     *方法: 设置java.lang.String
     *@param: java.lang.String  卡号
     */
    public void setCardno(java.lang.String cardno){
        this.cardno = cardno;
    }
    /**
     *方法: 取得java.lang.Integer
     *@return: java.lang.Integer  状态，0未使用,1已分配，待审核，2,已使用
     */
    @Column(name ="STATE",nullable=false,precision=10,scale=0)
    public java.lang.Integer getState(){
        return this.state;
    }

    /**
     *方法: 设置java.lang.Integer
     *@param: java.lang.Integer  状态，0未使用,1已分配，待审核，2,已使用
     */
    public void setState(java.lang.Integer state){
        this.state = state;
    }
    /**
     *方法: 取得java.util.Date
     *@return: java.util.Date  时间
     */
    @Column(name ="CREATETIME",nullable=false)
    public java.util.Date getCreatetime(){
        return this.createtime;
    }

    /**
     *方法: 设置java.util.Date
     *@param: java.util.Date  时间
     */
    public void setCreatetime(java.util.Date createtime){
        this.createtime = createtime;
    }
    /**
     *方法: 取得java.lang.Integer
     *@return: java.lang.Integer  操作人
     */
    @Column(name ="CREATEUSERID",nullable=false,precision=10,scale=0)
    public java.lang.Integer getCreateuserid(){
        return this.createuserid;
    }

    /**
     *方法: 设置java.lang.Integer
     *@param: java.lang.Integer  操作人
     */
    public void setCreateuserid(java.lang.Integer createuserid){
        this.createuserid = createuserid;
    }

    @OneToOne
    @JoinColumn(name = "productid", insertable = false, updatable = false)
    public MallProductEntity getProduct() {
        return product;
    }

    public void setProduct(MallProductEntity product) {
        this.product = product;
    }

    @OneToOne
    @JoinColumn(name = "shopid", insertable = false, updatable = false)
    public MallShopEntity getShop() {
        return shop;
    }

    public void setShop(MallShopEntity shop) {
        this.shop = shop;
    }

    @OneToOne
    @JoinColumn(name = "etcsupplierid", insertable = false, updatable = false)
    public MallEtcSupplierEntity getEtcSupplier() {
        return etcSupplier;
    }

    public void setEtcSupplier(MallEtcSupplierEntity etcSupplier) {
        this.etcSupplier = etcSupplier;
    }

    @Transient
    public String getCardNoPrefix() {
        return cardNoPrefix;
    }

    public void setCardNoPrefix(String cardNoPrefix) {
        this.cardNoPrefix = cardNoPrefix;
    }

    @Transient
    public String getStartCardNo() {
        return startCardNo;
    }

    public void setStartCardNo(String startCardNo) {
        this.startCardNo = startCardNo;
    }

    @Transient
    public String getEndCardNo() {
        return endCardNo;
    }

    public void setEndCardNo(String endCardNo) {
        this.endCardNo = endCardNo;
    }
    @OneToOne(cascade=CascadeType.DETACH,fetch = FetchType.LAZY)
    @JoinColumn(name = "cardNo",referencedColumnName="cardNo",nullable = true,updatable = false,insertable = false)
    public MallEtcUserEntity getEtcUser() {
        return etcUser;
    }

    public void setEtcUser(MallEtcUserEntity etcUser) {
        this.etcUser = etcUser;
    }
}
